const contractDraft = {
  state: {
    // 是否多税率
    isMultiRateCode: false,
    isMultiRateStatus: false,
    // 税率切换
    taxRate: 0,
    taxRateObj: {},
    // 供应商信息
    supplierData: {},
    supplierBData: {},
    // 协议
    protocalData: [],
    echoProtocalData: [],
    // 合同金额(含税)
    contractPriceIncludeTax: 0,
    // 合同金额(不含税)
    contractPriceExcludeTax: 0,
    orgId: "",
    setDelectList: false,
    rangeObj: {},
    showDoubleTable: false, // 协议、计划、方案前置条件
    purchaseListStatus: true, // 框架协议是否push到清单状态
    routeUrl: "",
    agreementSelectStatus: false,
    removeInventoryList: false,
    removeInventoryListStatus: false,
    isOverseas: 3, // 是否海外采购
    // 币种
    currencyObj: {
      code: '1',
      name: '人民币'
    },
    protocalCode: '',
    removeSupplier: false,
    removeSupplierB: false,
    listInputValStatus: false,
    specificationsArr: ["1305", "1306", "1307", "1308", "1309", "990103"],
    confirmDeleteList: [],
    tableHeadRuleNode: [
      "数量",
      "税率",
      "含税单价",
      "交货时间",
      "交货地点",
      "设备物资编码",
      "设备物资名称",
      "分类名称",
      "计量单位",
      "不含税金额",
      "不含税单价",
      "含税金额",
      "税额",
      "生产厂家/品牌"
    ],
    payTableHeadRuleNode: ["规定时间", "付款方式", "付款比率"],
    // 上传文件的限制类型
    uploadFileRules: [
      ".xlsx",
      ".xls",
      ".doc",
      ".docx",
      ".ppt",
      ".pptx",
      ".pdf",
      ".jpg",
      ".png",
      ".txt",
      ".rft",
      ".msg",
      ".wps",
      ".et",
      ".dps",
      ".vsd",
      ".prn",
      ".ai",
      ".cad",
      ".tiff",
      ".swf",
      ".bmp",
      ".gif",
      ".jpeg",
      ".jpe",
      ".rar",
      ".zip",
      ".7z",
      ".lzh",
      ".webp",
      ".ofd"
    ],
    // 供应商的操作  [事件, 事件名]
    // selectPartyBStrategy: new Map([
    //   ["search", "selectPartyBSearch"],
    //   ["pageSize", "selectPartyBPageSize"],
    //   ["pageNo", "selectPartyBPageNo"],
    //   ["closeReset", "selectPartyBReset"],
    //   ["reset", "selectPartyBReset"]
    // ]),
    selectPartyBStrategy: {
      "search": "selectPartyBSearch",
      "pageSize": "selectPartyBPageSize",
      "pageNo": "selectPartyBPageNo",
      "closeReset": "selectPartyBReset",
      "reset": "selectPartyBReset"
    },
    selectProjectNameStrategy: {
      "search": "selectProjectNameSearch",
      "pageSize": "selectProjectNamePageSize",
      "pageNo": "selectProjectNamePageNo",
      "closeReset": "selectProjectNameReset",
      "reset": "selectProjectNameReset"
    },
    selectAccountingOrganStrategy: {
      "search": "selectAccountingOrganSearch",
      "pageSize": "selectAccountingOrganPageSize",
      "pageNo": "selectAccountingOrganPageNo",
      "closeReset": "selectAccountingOrganReset",
      "reset": "selectAccountingOrganReset"
    },
    invoiceOrc: [
      ".pdf",
      ".jpg",
      ".png",
      ".jpeg",
      '.JPEG',
      ".JPG",
      ".PNG",
      ".PDF",
      ".bmp",
      '.BMP',
      ".TIFF",
      '.tiff',
      '.ofd',
      '.OFD'
    ]
  },

  mutations: {
    SET_TAX_RATE: (state, taxRate) => {
      state.taxRate = taxRate;
    },
    SET_TAX_RATE_OBJ: (state, val) => {
      state.taxRateObj = val;
    },
    SET_MULTI_RATE_CODE: (state, val) => {
      state.isMultiRateCode = val;
    },
    SET_MULTI_RATE_STATUS: (state, val) => {
      state.isMultiRateStatus = val;
    },
    SET_SUPPLIER_DATA: (state, val) => {
      state.supplierData = val;
    },
    SET_SUPPLIER_B_DATA: (state, val) => {
      state.supplierBData = val;
    },
    SET_PROTOCAL_DATA: (state, val) => {
      state.protocalData = val;
    },
    SET_ECHO_PROTOCAL_DATA: (state, val) => {
      state.echoProtocalData = val;
    },
    SET_CONTRACT_PRICE_INCLUDE_TAX: (state, val) => {
      state.contractPriceIncludeTax = val;
    },
    SET_CONTRACT_PRICE_EXCLUDE_TAX: (state, val) => {
      state.contractPriceExcludeTax = val;
    },
    SET_ORG_ID: (state, val) => {
      state.orgId = val;
    },
    SET_DELECT_LIST: (state, val) => {
      state.setDelectList = val;
    },
    SET_RANGE_LIST: (state, val) => {
      state.rangeObj = val;
    },
    SET_SHOW_DOUBLE_TABLE: (state, val) => {
      state.showDoubleTable = val;
    },
    SET_PURCHASE_LIST_STATUS: (state, val) => {
      state.purchaseListStatus = val;
    },
    SET_CONFIRM_DELETE_LIST: (state, val) => {
      state.confirmDeleteList = val;
    },
    SET_ROUTE_URL: (state, val) => {
      state.routeUrl = val;
    },
    SET_AGREEMENT_SELECT_STATUS: (state, val) => {
      state.agreementSelectStatus = val;
    },
    SET_REMOVE_INVENTORY_LIST: (state, val) => {
      state.removeInventoryList = val;
    },
    SET_IS_OVERSEAS: (state, val) => {
      state.isOverseas = val;
    },
    SET_REMOVE_INVENTORY_LIST_STATUS: (state, val) => {
      state.removeInventoryListStatus = val;
    },
    SET_PROTOCAL_CODE: (state, val) => {
      state.protocalCode = val;
    },
    SET_REMOVE_SUPPLIER: (state, val) => {
      state.removeSupplier = val;
    },
    SET_REMOVE_SUPPLIER_B: (state, val) => {
      state.removeSupplierB = val;
    },
    SET_CURRENCY_OBJ: (state, val) => {
      state.currencyObj = {
        ...state.currencyObj,
        ...val
      };
    },
    SET_LIST_INPUT_VAL: (state, val) => {
      state.listInputValStatus = val;
    },
    RESET: state => {
      state.isMultiRateCode = false;
      state.showDoubleTable = false;
      state.agreementSelectStatus = false;
      state.listInputValStatus = false;
      state.purchaseListStatus = true;
      state.taxRate = 0;
      state.taxRateObj = {};
      state.supplierData = {};
      state.protocalData = [];
      state.echoProtocalData = [];
      state.contractPriceIncludeTax = 0;
      state.orgId = "";
      state.routeUrl = "";
      state.setDelectList = false;
      state.isOverseas = 3;
      state.currencyObj = {
        code: '1',
        name: '人民币'
      };
    }
  },

  actions: {
    setTaxRate({ commit }, val) {
      commit("SET_TAX_RATE", val);
    },
    setTaxRateObj({ commit }, taxRate) {
      commit("SET_TAX_RATE_OBJ", taxRate);
    },
    setMultiRateCode({ commit }, state) {
      commit("SET_MULTI_RATE_CODE", state);
    },
    setMultiRateStatus({ commit }, state) {
      commit("SET_MULTI_RATE_STATUS", state);
    },
    setSupplierData({ commit }, val) {
      commit("SET_SUPPLIER_DATA", val);
    },
    setSupplierBData({ commit }, val) {
      commit("SET_SUPPLIER_B_DATA", val);
    },
    setProtocalData({ commit }, val) {
      commit("SET_PROTOCAL_DATA", val);
    },
    setEchoProtocalData({ commit }, val) {
      commit("SET_ECHO_PROTOCAL_DATA", val);
    },
    setOrgId({ commit }, val) {
      commit("SET_ORG_ID", val);
    },
    setContractPriceIncludeTax({ commit }, val) {
      commit("SET_CONTRACT_PRICE_INCLUDE_TAX", val);
    },
    setContractPriceExcludeTax({ commit }, val) {
      commit("SET_CONTRACT_PRICE_EXCLUDE_TAX", val);
    },
    setDelectList({ commit }, val) {
      commit("SET_DELECT_LIST", val);
    },
    setRangeList({ commit }, val) {
      commit("SET_RANGE_LIST", val);
    },
    setShowDoubleTable({ commit }, val) {
      commit("SET_SHOW_DOUBLE_TABLE", val);
    },
    setPurchaseListStatus({ commit }, val) {
      commit("SET_PURCHASE_LIST_STATUS", val);
    },
    setConfirmDeleteList({ commit }, val) {
      commit("SET_CONFIRM_DELETE_LIST", val);
    },
    setRouteUrl({ commit }, val) {
      commit("SET_ROUTE_URL", val);
    },
    setAgreementSelectStatus({ commit }, val) {
      commit("SET_AGREEMENT_SELECT_STATUS", val);
    },
    setRemoveInventoryList({ commit }, val) {
      commit("SET_REMOVE_INVENTORY_LIST", val);
    },
    setIsOverseas({ commit }, val) {
      commit("SET_IS_OVERSEAS", val);
    },
    setRemoveInventoryListStatus({ commit }, val) {
      commit("SET_REMOVE_INVENTORY_LIST_STATUS", val);
    },
    setProtocalCode({ commit }, val) {
      commit("SET_PROTOCAL_CODE", val);
    },
    setCurrencyObj({ commit }, val) {
      commit("SET_CURRENCY_OBJ", val);
    },
    setRemoveSupplier({ commit }, val) {
      commit("SET_REMOVE_SUPPLIER", val);
    },
    setRemoveSupplierB({ commit }, val) {
      commit("SET_REMOVE_SUPPLIER_B", val);
    },
    setListInputValStatus({ commit }, val) {
      commit("SET_LIST_INPUT_VAL", val);
    },
    reset({ commit }) {
      commit("RESET");
    }
  }
};

export default contractDraft;
